<?php

namespace app\api\validate;

use think\Validate;

class Device extends Validate
{
    protected $failException = true;

    protected $rule = [
        'name' => 'require',
        'code' => 'require|unique:device',
        'imei'   => 'require|unique:device',
        'space'  => 'require',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'edit'             => ['name', 'code', 'warranty_day','agent_id'],
        'changePassword'   => ['password'],
        'retrievePassword' => ['account', 'captcha', 'password'],
    ];

    public function __construct()
    {
        $this->field   = [
        	'name' =>'设备名称',
        	'code' => '设备码',
            'imei' => 'IMEI',
            'warranty_day'   =>'有效期',
            'space' => '所属场地'
        ];

        parent::__construct();
    }
}